#ifndef __MEMORY_POOL_H__
#define __MEMORY_POOL_H__

#define NODE_SIZE  1024
#define NODE_COUNT  8


class MemoryPool
{

public:
    MemoryPool();

    ~MemoryPool();

public:
    /* 分配空间 */
    void * Allocate();

    /* 释放空间 */
    void free(void * ptr);

private:

    struct UseNode
    {
        char Node[NODE_SIZE];
        UseNode * next;
    };

    /* 块 */ 
    struct Block
    {
        UseNode node[NODE_COUNT];
        Block * next;
    };
private:
    /* 大内存块 */
    Block * m_blockHead;
    /* 小内存块 */
    UseNode * m_nodeHead;

};



#endif